﻿@using RooHui.Infrastructure.Entities.Entity;
@using RooHui.Tool;
@{
    ViewBag.Title = "融汇贷管理后台";
    Layout = "../Shared/_AdminBase.cshtml";
    List<Module> menuList = ViewBag.moduleList as List<Module>;
    User loginUser = new User();
    loginUser = ViewBag.User;
                                        //List<Module> firstMenu = menuList.FindAll(c => c.ParentID == 0);
                                        //ViewBag.firstMenu = firstMenu.ToJson();
                                        //ViewBag.menuJson = menuList.ToJson();
}
<table border="0" width="100%" id="tblayout" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="2">
            <div class="navbar navbar-default">
                <div class="navbar-container">
                    <div class="pull-left" style="padding-top: 5px;">
                        <a href="#" style="text-decoration: none;" class="navbar-brand"><i class="icon-magic icon-white">
                        </i>融汇贷管理中心 </a>
                    </div>
                    <div class="pull-right">
                        <ul class="nav ace-nav">
                            <ul class="nav ace-nav">
                                <li class="purple"><a style="padding: 0 10px 0;" data-toggle="dropdown" class="dropdown-toggle"
                                    href="javascript:;"><i class="icon-lemon"></i></a>
                                    <ul class="pull-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">
                                        <li class="dropdown-header"><i class="icon-retweet"></i>工具箱</li>
                                        <li><a target="_blank" href="/#snacks">
                                            <div class="clearfix">
                                                <span class="pull-left"><i class="btn btn-xs no-hover btn-pink icon-heart"></i>计算器
                                                </span>
                                            </div>
                                        </a></li>
                                        <li><a target="_blank" href="/#cake">
                                            <div class="clearfix">
                                                <span class="pull-left"><i class="btn btn-xs btn-primary icon-coffee"></i>完善中..</span>
                                            </div>
                                        </a></li>
                                        <li><a target="_blank" href="/#drink">
                                            <div class="clearfix">
                                                <span class="pull-left"><i class="btn btn-xs no-hover btn-success icon-beer"></i>完善中..
                                                </span>
                                            </div>
                                        </a></li>
                                    </ul>
                                </li>
                                <li class="grey"><a style="padding: 0 10px 0;" data-toggle="dropdown" class="dropdown-toggle"
                                    href="#"><i class="icon-envelope "></i></a>
                                    <ul id="cartbox" class="innerclick pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
                                        <li class="dropdown-header"><i class="icon-envelope"></i>收到<span id="cmdcount"> 0</span>条消息</li>
                                        <li class="noncommodity"><a href="javascript:;">
                                            <div style="text-align: center;">
                                                您还没有收到消息
                                            </div>
                                        </a></li>
                                    </ul>
                                </li>
                                <li class="green"><a style="padding: 0 10px 0;" data-toggle="dropdown" class="dropdown-toggle"
                                    href="#"><i class="icon-tasks"></i></a>
                                    <ul class="innerclick pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
                                        <li class="dropdown-header"><i class="icon-tasks"></i>快捷菜单</li>
                                        @* <li><a href="#">
                                            <img src="/images/product/kebikeshupian(tong).jpg" alt="可比克薯片（桶装）110g" class="msg-photo">
                                            <span class="msg-body"><span class="msg-title">可比克薯片</span> <span class="msg-time">
                                                <input type="button" commodity-id="1" commodity-price="8.00" data-placement="top"
                                                    data-content="已添加至购物车" data-html="false" data-trigger="click" class="populartocart btn btn-primary btn-minier"
                                                    value="加入购物车">
                                                <input type="button" class="popularbuy btn btn-warning btn-minier" value="立即购买">
                                            </span></span></a></li>*@
                                        <li><a target="Right" href="#">
                                            <div class="clearfix">
                                                <span class="pull-left"><i class="btn btn-xs no-hover btn-success icon-list-alt"></i>完善中..
                                                </span>
                                            </div>
                                        </a></li>
                                        <li><a target="Right" href="#">
                                            <div class="clearfix">
                                                <span class="pull-left"><i class="btn btn-xs no-hover btn-success icon-list-alt"></i>完善中..
                                                </span>
                                            </div>
                                        </a></li>
                                        <li></li>
                                    </ul>
                                </li>
                                <li class="light-blue"><a style="padding: 0 10px 0;" data-toggle="dropdown" href="#"
                                    class="dropdown-toggle"><i class="icon-user icon-2x"></i><span class="user-info">@loginUser.RealName
                                    </span><i class="icon-caret-down"></i></a>
                                    <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                                        <li><a href="/order/list" target="Right"><i class=" icon-lock"></i>修改密码</a></li>
                                        <li class="divider"></li>
                                        <li><a href="/account/signout" target="Right"><i class="icon-signout"></i>退出</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </ul>
                    </div>
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td rowspan="3" valign="top">
            <div class="main-container">
                <div class="main-container-inner">
                    <div class="sidebar" id="sidebar" style="overflow-y: auto;">
                        <ul class="nav nav-list">
                            @{
                                if (menuList != null && menuList.Count > 0)
                                {
                                    var firstMenus = menuList.FindAll(c => c.ParentID == 0 && c.IsDisplay).ToList();
                                    foreach (var firstMenu in firstMenus)
                                    {
                                        var secondMenus = menuList.FindAll(c => c.ParentID == firstMenu.ID && c.IsDisplay).ToList();
                                <li><a href="javascript:;" id="@firstMenu.ID" class="dropdown-toggle"><i class="@firstMenu.Icon">
                                </i><span class="menu-text">@firstMenu.Name</span><b class="arrow icon-angle-down"></b>
                                </a>
                                    <ul class="submenu">
                                        @{
                                        if (secondMenus != null && secondMenus.Count > 0)
                                        {
                                            foreach (var secondMenu in secondMenus)
                                            {
                                            <li><a href="javascirpt:;" onclick="linktocontent(this,'@secondMenu.Url')" target="Right"><i class="@secondMenu.Icon"></i>@secondMenu.Name</a></li>
                                            }
                                        }
                                        }
                                    </ul>
                                </li>
                                    }
                                }
                            }
                        </ul>
                    </div>
                </div>
            </div>
        </td>
        <td>
            <div class="sidebar-shortcuts" style="text-align:left; padding-left:30px;">
                @DateTime.Now.ToString("今天是：yyyy年MM月dd日")
                @("星期"+"日一二三四五六".Substring((int)System.DateTime.Now.DayOfWeek,1))
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="divMain">
                @RenderBody()
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <div class="sidebar-shortcuts">
                重庆xxx科技有限责任公司 版权所有 &copy; Copyright 2013 渝ICP备 xxxxxxx
            </div>
        </td>
    </tr>
</table>
@section tail{
    <script type="text/javascript">
        function linktocontent(sender, url) {
            $(sender).parent().siblings('li').removeClass('active');
            $(sender).parent().addClass("active");
            $('#Right').attr('src', url);
        }
        $(function () {
            $('.innerclick').click(function (e) {
                e.stopPropagation();
            });
            $('.dominus').click(function () {
                var obj = $(this).siblings('span');
                if (obj.text() == '1') {
                }
                obj.text(parseInt(obj.text(), 10) - 1);
            });
            $('.doplus').click(function () {
                var obj = $(this).siblings('span');
                obj.text(parseInt(obj.text(), 10) + 1);
            });
            var c = $("#sidebar").hasClass("menu-min");
            $(".nav-list").on('click', function (h) {
                var g = $(h.target).closest("a");
                if (!g || g.length == 0) {
                    return
                }
                var f = g.next().get(0);
                if (!$(f).is(":visible")) {
                    var d = $(f).parent().closest("ul");
                    if (c && d.hasClass("nav-list")) {
                        return
                    }
                    d.find("> .open > .submenu").each(function () {
                        if (this != f && !$(this.parentNode).hasClass("active")) {
                            $(this).slideUp(200).parent().removeClass("open")
                        }
                    })
                }
                $(f).slideToggle(200).parent().toggleClass("open");
                return false
            })
        });
    </script>
    <script type="text/javascript">
        function SetBodySize() {
            //            var tblayout = $("#tblayout");
            //            tblayout.height($(window).height());
            var sideDiv = $("#sidebar");
            var _divHeight = $(window).height() - 45;
            sideDiv.height(_divHeight);

            var mainDiv = $("#divMain");
            var mainDivHeight = $(window).height() - 120;
            mainDiv.height(mainDivHeight);

            var frameright = $("#Right");
            var framerightWidth = $(window).width() - 195;
            frameright.width(framerightWidth);

            var framerightHeight = $(window).height() - 120;
            frameright.height(framerightHeight);
        }
    </script>
}
